package searchtab.actions;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;

import searchtab.SearchTabActivator;

public class NextMatchAction extends Action implements IWorkbenchWindowActionDelegate {

    private IWorkbenchWindow fWindow;

    public NextMatchAction() {
    }

    public void dispose() {
        fWindow = null;
    }

    public void init(IWorkbenchWindow window) {
        fWindow = window;
    }

    public void run(IAction iaction) {
        if (fWindow.getActivePage() == null) {
            return;
        }
        SearchTabActivator.getDefault().getSearcherEngine().goToNextMatch();
    }

    public void selectionChanged(IAction iaction, ISelection iselection) {
        // do nothing since the action isn't selection dependent.

    }

}
